﻿/*
 * File: BattlegroundBottomMenuScene.cs
 * Author: Gourav Das
 * Purpose: Load and show 2nd Battleground menu scene
 * Created: May 01 2011
 * Copyright: Gourav Das, 2011
 */

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using _22yards._2D;
using _22yards.Scenes.Helpers;

namespace _22yards.Scenes
{
    class BottomBattlegroundMenuScene : BaseMenuScene
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="BottomBattlegroundMenuScene"/> class.
        /// </summary>
        /// <param name="Title">The title.</param>
        public BottomBattlegroundMenuScene(string Title)
            : base(Title)
        {
            // Create our menu entries.
            MenuItem SingleMatchMenuItem = new MenuItem("One-Off Match",0);
            MenuItem TournamentMenuItem = new MenuItem("Tournament",1);
            MenuItem ChallengesMenuItem = new MenuItem("Challenge Self",2);
            MenuItem BackMenuEntry = new MenuItem("Back",3,false, true);

            // Hook up menu event handlers.
            SingleMatchMenuItem.Selected += SingleMatchMenuItem_Selected;
            TournamentMenuItem.Selected += TournamentMenuItem_Selected;
            ChallengesMenuItem.Selected += ChallengesMenuItem_Selected;
            BackMenuEntry.Selected += BackMenuEntry_Selected;

            // Add Items to the menu.
            MenuItems.Add(SingleMatchMenuItem);
            MenuItems.Add(TournamentMenuItem);
            MenuItems.Add(ChallengesMenuItem);
            MenuItems.Add(BackMenuEntry);
        }

        ~BottomBattlegroundMenuScene()
        {
            ExitScene();
        }


        /// <summary>
        /// Event handler for when the SingleMatchMenuItem is selected.
        /// </summary>
        void SingleMatchMenuItem_Selected(object sender, PlayerIndexEventArgs e)
        {
            ExitScene();
            //LoadingScene.Load(sceneEngine, true, e.PlayerIndex, new TeamSelectionScene("Team Selection"));
            sceneEngine.AddScene(new TeamSelectionScene("Team Selection"), e.PlayerIndex);
        }


        /// <summary>
        /// Event handler for when the TournamentMenuItem is selected.
        /// </summary>
        void TournamentMenuItem_Selected(object sender, PlayerIndexEventArgs e)
        {
            const string msg = "Please be patient, will be implementing soon!!";

            MsgBoxScreen confirmExitMsgBox = new MsgBoxScreen(msg);
            confirmExitMsgBox.Accepted += OnCancel;

            sceneEngine.AddScene(confirmExitMsgBox, e.PlayerIndex);
        }


        /// <summary>
        /// Event handler for when the ChallengesMenuItem menu Item is selected.
        /// </summary>
        void ChallengesMenuItem_Selected(object sender, PlayerIndexEventArgs e)
        {
            const string msg = "Please be patient, will be implementing soon!!";

            MsgBoxScreen confirmExitMsgBox = new MsgBoxScreen(msg);
            confirmExitMsgBox.Accepted += OnCancel;

            sceneEngine.AddScene(confirmExitMsgBox, e.PlayerIndex);
        }

        /// <summary>
        /// Event handler for when the BackMenuEntry item is selected.
        /// </summary>
        void BackMenuEntry_Selected(object sender, PlayerIndexEventArgs e)
        {
            ExitScene();
            sceneEngine.AddScene(new TopBattlegroundMenuScene(), e.PlayerIndex);
        }

        /// <summary>
        /// When the user presses ESC, do nothing.
        /// </summary>
        protected override void OnCancel(PlayerIndex _playerIndex)
        {
            //Do nothing :)
        }

    }

}
